package Day17;

import java.util.Locale;
import java.util.Scanner;

/**
 * Creat with IntelliJ IDEA
 * Description
 * User: mamba24
 * Date: 2022-09-30
 * Time: 20:19
 * To BE A Better Person-2020-3-2
 */
public class TestDemo2 {
    public static void main(String[] args) {
        Scanner sc=new Scanner(System.in);
        String a=sc.nextLine();
        String b=sc.next();
        b=b.toLowerCase();
        a=a.toLowerCase();
        char temp=b.charAt(0);
        int time=0;
        for (int i = 0; i < a.length(); i++) {
            if(a.charAt(i) == temp){
                time++;
            }
        }
        System.out.println(time);
    }
}
